<!--
 * Copyright 2018 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 -->
<!DOCTYPE html>
<html ng-app="sampleApp">
<head>
  <base target="_top">
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/intercom.js/0.1.4/intercom.min.js"></script>
</head>
<body ng-controller="SampleController as sample">
  <div ng-show="!sample.isSignedIn">
    <p>Please sign in to your GitHub account to continue.</p>
    <button ng-click="sample.signIn()">Sign in</button>
  </div>
  <div ng-show="sample.isSignedIn">
    <div>
      <p>Hello {{sample.user.login || '...' }}</p>
      <button ng-click="sample.signOut()">Sign out</button>
    </div>
    <p>Repos:</p>
    <li ng-repeat="repo in sample.repos">
      <a href="{{repo.html_url}}">{{repo.name}}</a> ({{repo.stargazers_count}} stars, {{repo.forks_count}} forks)
    </li>
  </div>

  <script>
    var email = '<?= email ?>';
    var isSignedIn = '<?= isSignedIn ?>' === 'true';
  </script>
  <?!= include('JavaScript') ?>
</body>
</html>
